package com.xj.demo.reference;

import java.lang.ref.SoftReference;

/**
 * VM args: -Xmx10m -Xms10m
 */
public class SoftObjTest {
    public static void main(String[] args) {
        SoftReference sr = new SoftReference(new Object());
        System.out.println(sr.get());
        try{
            byte[] bytes = new byte[7 * 1024 * 1024];
        }catch (Throwable e){
            e.printStackTrace();
        }finally {
            System.out.println(sr.get());
        }
    }
}
